package com.example.testdb1.mapper;

// import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.testdb1.entity.Student;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface StuMapper extends BaseMapper<Student> {

    @Insert("insert into  `student` (sname,sage,ssex,password) values (#{sname},#{sage},#{ssex},#{password})")
    void add(Student student);

    @Select("select  * from `student`")
    List<Student> list();

    @Delete("delete from `student` where sid=#{sid}")
    void delete(Long id);

    // @Update("update `student` set sname=#{sname},sage=#{sage},ssex=#{ssex} where sid=#{sid}")
    void update(Student student);

    Page<Student> page(LocalDateTime start, LocalDateTime end);

    @Select("select * from `student` where sname=#{sname} and password=#{newPassword}")
    Student login(String sname,String  newPassword);
}
